using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using HISModels.Entities;

namespace HISModels.Mapping
{
	public class SysLogMap : EntityTypeConfiguration<SysLog>
	{
		public SysLogMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			this.Property(t => t.TableName)
				.HasMaxLength(50);
				
			this.Property(t => t.RecordID)
				.HasMaxLength(50);
				
			this.Property(t => t.UserID)
				.HasMaxLength(50);
				
			this.Property(t => t.ColumnName)
				.HasMaxLength(100);
				
			this.Property(t => t.EventType)
				.IsFixedLength()
				.HasMaxLength(1);
				
			// Table & Column Mappings
			this.ToTable("SysLogs");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.TableName).HasColumnName("TableName");
			this.Property(t => t.RecordID).HasColumnName("RecordID");
			this.Property(t => t.UserID).HasColumnName("UserID");
			this.Property(t => t.ColumnName).HasColumnName("ColumnName");
			this.Property(t => t.CurrentValue).HasColumnName("CurrentValue");
			this.Property(t => t.BeforeValue).HasColumnName("BeforeValue");
			this.Property(t => t.EventDateUTC).HasColumnName("EventDateUTC");
			this.Property(t => t.EventType).HasColumnName("EventType");
		}
	}
}

